﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!checkLoginAdmin())
                Response.Redirect("Login.aspx");
            else
                Response.Redirect("OrderTour.aspx");
        }
    }

    // check login
    public bool checkLoginAdmin()
    {
        // check session
        if (Session["username"] != null)
        {
            return true;
        }
        else
        {
            // check cookie 
            if (Request.Cookies["username"] != null)
            {
                Session["username"] = Request.Cookies["username"].Value;
                Session["fullname"] = Request.Cookies["fullname"].Value;
                return true;
            }

        }
        return false;
    }
}